package com.allwees.bs.c.module.product.dto;

import com.allwees.bs.c.module.product.entity.ProductEntity;
import com.allwees.bs.core.model.product.entity.ProductModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class ProductSimpleDTO extends ProductModel {

	private static final long serialVersionUID = 9190934400257438799L;

	protected String[] photos;

	public ProductSimpleDTO(ProductEntity product) {
		this(product, false);
	}

	public ProductSimpleDTO(ProductEntity product, boolean fullMode) {
		setUuid(product.getUuid());
		setRetailerUuid(product.getRetailerUuid());
		setStoreUuid(product.getStoreUuid());
		setNo(product.getNo());
		setName(product.getName());
		setCategoryNo(product.getCategoryNo());
		setStatus(product.getStatus());
		setMainPhoto(product.getMainPhoto());
		setOriginalPrice(product.getOriginalPrice());
		setRetailPrice(product.getRetailPrice());
		setShippingPrice(product.getShippingPrice());
		setCurrency(product.getCurrency());
		setRating(product.getRating());
		setPublishAt(product.getPublishAt());

		setTotalSales(product.getTotalSales());
		setSalesTotal(product.getSalesTotal());
		setTotalCollections(product.getTotalCollections());
		setTotalReviews(product.getTotalReviews());
		setTotalViews(product.getTotalViews());
		setTotalShares(product.getTotalShares());

		setShippingArrivalDesc(product.getShippingArrivalDesc());
		setShippingMinDays(product.getShippingMinDays());
		setShippingMaxDays(product.getShippingMaxDays());
		setMarketingType(product.getMarketingType());

		if(fullMode) {
			setKeywords(product.getKeywords());
			setDescription(product.getDescription());
			setPhotos(product.getPhotos());
		}
	}

	@Override
	public String[] getPhotos() {
		return super.getPhotos();
	}

	@Override
	public void setPhotos(String[] photos) {
		super.setPhotos(photos);
	}
}
